<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>3D转换之3D导航栏案例</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            margin: 100px;
        }

        ul li {
            float: left;
            margin: 5px 5px;
            width: 120px;
            height: 35px;
            list-style: none;
            /* 一会需要给box旋转，也需要旋转。因此，干脆给li加里面的子盒子都有透视效果 */
            perspective: 500px;
        }

        .box {
            position: relative;
            width: 100%;
            height: 100%;
            transform-style: preserve-3d;
            transition: all .4s;
        }

        .box:hover {
            transform: rotateX(90deg);
        }

        .front,
        .bottom {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            text-align: center;
            line-height: 35px;
            font-size: 14px;
            color: black;

        }

        .front {
            background-color: pink;
            z-index: 1;
            transform: translateZ(17.5px);
        }

        .bottom {
            background-color: purple;
            /* 这个x轴一定是负值 */
            /* 如果有移动或者其他样式，必须先写移动再旋转 */
            transform: translateY(17.5px) rotateX(-90deg);
        }
    </style>
</head>

<body>
    <ul>
        <li>
            <div class="box">
                <div class="front">tluer</div>
                <div class="bottom">njuster</div>
            </div>
        </li>
    </ul>
    <ul>
        <li>
            <div class="box">
                <div class="front">tluer</div>
                <div class="bottom">njuster</div>
            </div>
        </li>
    </ul>
    <ul>
        <li>
            <div class="box">
                <div class="front">tluer</div>
                <div class="bottom">njuster</div>
            </div>
        </li>
    </ul>
    <ul>
        <li>
            <div class="box">
                <div class="front">tluer</div>
                <div class="bottom">njuster</div>
            </div>
        </li>
    </ul>

    <ul>
        <li>
            <div class="box">
                <div class="front">tluer</div>
                <div class="bottom">njuster</div>
            </div>
        </li>
    </ul>
</body>

</html>